#ifndef SEND_H
#define SEND_H

#include <iostream>
#include <wiringSerial.h>
#include <sys/types.h>		// For POSIX datatypes
#include <stdint.h>		// For POSIX datatypes
#include <openssl/md4.h>	// For hashing
#include <stdio.h>
#include <string.h>
#define BAUD_RATE 57600 
#define SER_PORT "/dev/ttyUSB0"
#define DIGEST_SIZE 16
#define MAX_MSG_SIZE 0xFF	// Max size of a message
#define HEADER_SIZE 5
#define CALL_CARD 0x55		// ID of a message

typedef struct xMsg{
	uint8_t callCard;	// Signifies start of a message
	uint8_t toAddr;		// Address of sender
	uint8_t fromAddr;	// Address of receiver
	uint8_t size;		// Size of message body
	uint8_t confirmation;	// Used like boolean
	uint8_t headerDigest[DIGEST_SIZE];	// Digest of address and size header CURRENTLY UNIMPLEMENTED
	uint8_t messageBody[MAX_MSG_SIZE];	// Body of the message 
	uint8_t messageBodyDigest[DIGEST_SIZE];	// Digest of the message body
} xMsg;


xMsg * createMessage(uint8_t to, uint8_t from, uint8_t size, uint8_t * data);


int sendMessage(xMsg * msg, int fd);

#endif
